cd2021 - 40823109

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • Stage1
    • W1
      • SSH setup
      • set website
    • W2
      • 草圖繪製
      • 3D圖繪製
    • W3
      • 3D爆炸圖與工作圖
      • 傳動設計修改
    • W4
  • stage2
    • W5
    • W6
    • W7
    • W8
    • W9
  • stage3
    • W10
      • task1
      • task2
    • W11
      • task 3
    • W13
    • W15
      • using geometry
      • using algebra
    • W16
      • 1. Onshape 零組件繪製
      • 2.建立 CoppeliaSim 4.1.0 MTB robot 場景
      • 3.手臂末端加入吸盤
      • 4.逆向運動學函式
      • 5.Python remote API 逆向運動學函式
    • 專案成果
  • w18
    • 期末報告影片
  • Questions and answers
    • ValueError
    • pip無法使用
    • leo 無法使用
W15 << Previous Next >> using algebra

using geometry

We saw this simple two-link robot in the previous lecture about forward kinematics.

我們在上一堂關於正向運動學的講座中看到了這個簡單的二連桿機構。

 

The tooltip pose of this robot is described simply by two numbers, the coordinates x and y with respect to the world coordinate frame.

該機構的工具提示姿態由兩個數字簡單描述,相對於世界的坐標系的坐標的X和Y。

 

So, the problem here is that given x and y, we want to determine the joined angles, q1 and q2.

所以,這個問題在這裡是給定x跟y,我們想要求出這個節點的角度q1跟q2。

 

The solution that we’re going to follow in this particular section is a geometric one.

這節我們將遵循這個特別的幾何方法來解決。

 

We’re going to start with a simple piece of construction.

我們將從一個簡單的結構開始。

 

We’re going to overlay the red triangle on top of our robot.

我們將一個紅色的三角形覆蓋在機構上。

 

We know that the end point coordinate is x, y, so the vertical height of the triangle is y, the horizontal width is x.

我們知道結束的點坐標是x跟y,所以三角形的垂直距離是y,水平距離是x。

 

And, using Pythagoras theorem, we can write r squared equals x squared plus y squared.

然後,利用畢氏定理,我們可以寫出 r2 = x2 +y2。

 

So far, so easy.

到這裡很容易。

 

Now, we’re going to look at this triangle highlighted here in red and we want to determine the angle alpha.

現在,我們開始看到這個以紅色突出顯示的三角形然後我們想確定α角。

 

In order to do that, we need to use the cosine rule.

為了做到這點,我們需要用到餘弦定理。

 

And, if you’re a little rusty on the cosine rule, here is a bit of a refresher.

如果你對餘弦定理有點生疏,這裡有一點複習。

 

We have an arbitrary triangle.

我們有任意一個三角形。

 

We don’t have any right angles in it and we’re going to label the length of this edge as A and the angle opposite that edge, we’re going to label as little a.

我們沒有任何直角,我們將這條邊的長度標記為 A,而與該邊相對的角度,我們將標記為小 a。

 

And, we do the same for this edge and this angle, and this edge and this angle.

並且,我們對這條邊和這個角,以及這條邊和這個角做同樣的事情。

 

So, all together, the sides are labelled capitals A, B and C, and the angles are labelled little a, little b, and little c.

因此,所有邊都標記為A、B、C,角標記為a、b、c。

 

So, the cosine rule is simply this relationship here.

餘弦定理就是這種關係。

 

It’s a bit like Pythagoras’ theorem except for this extra term on the end with the cos a in it.

它有點像畢達哥拉斯的定理,除了末尾有cos a以外。

 

Now, let’s apply the cosine rule to the particular triangle we looked at a moment ago.

現在,讓我們將餘弦定理用於我們剛才所看到的三角形。

 

It’s pretty straightforward to write down this particular relationship.

寫下這種特殊關係非常簡單。

 

We can isolate the term cos alpha which gives us the angle alpha that we’re interested in.

我們可以分離出cosα,它給出了我們需要的角度α。

 

And, it’s defined in terms of the constant link lengths, A1 and A2 and the position of the end effector, x and y.

而且,他是根據連桿長度A1跟A2以及末端執行器位置x、y來定義的。

 

We can write this simple relationship between the angles alpha and q2.

我們可以寫出簡單的關係在角度α跟q2之間。

 

And, we know from the shape of the cosine function that cos of q2 must be equal to negative of cos alpha.

而且,我們從餘弦函數的形狀知道,cosq2必須等於-cosα。

 

This time, let’s just write an expression for the cosine of the joined angle q2.

這一次,讓我們為節點角q2的餘弦函數寫一個表示式。

 

Now, we’re going to draw yet another red triangle and we’re going apply some simple trigonometry here.

現在,讓我們畫一個另外的三角形然後利用簡單的三角函數。

 

If we know q2, then we know this length and this length of the red triangle.

如果我們知道q2,甚至我們知道這個長度和這個紅色三角形的長度。

 

We can write this relationship for the sine of the joined angle q2.

我們可以寫出節點角q2的正弦關係。

 

Now, we can consider this bigger triangle whose angle is beta and this side length of this triangle is given here in blue.

現在,我們可以知道這個大的三角形,角度是β,然後由藍色表示此三角形的邊。

 

And, the length of the other side of the triangle is this.

且三角形另一邊長度是這個。

 

So, now we can write an expression for the angle beta in terms of these parameters here

所以,現在我們可以根據這些參數寫出角度β的表達式。

 

Going back to the red triangle that we drew earlier, we can establish a relationship between q1 and the angle beta.

回到我們之前畫的紅色三角形,我們可以建立q1和角度β之間的關係。

 

Introduce yet another angle, this one gamma and we can write a relationship between the angle gamma and the tooltip coordinates x and y.

引入另一個角度,γ,我們可以寫出角度γ和工具提示坐標x、y之間的關係。

 

Now, we can write a simple relationship between the angles that we’ve constructed, gamma and beta and the joined angle we’re interested in which is q

現在,可以寫出我們建構的角度γ和β與我們感興趣的節點角q之間的簡單關係。

 

And, the total relationship looks something like this.

而且,整個關係看起來像這樣。

 

Quite a complex relationship, it gives us the angle of joined one, that’s q1 in terms of the end effector coordinates y and x, and a bunch of constants, a1 and a2, and it’s also a function of the second joint angle, q2.

相當複雜的關係,它為我們提供了連接的角度,即末端執行器坐標q1的y和x,以及一系列常數a1和a2,它也是第二個節點角q2的函數。

 

So, let’s summarize what it is that we have derived here.

所以,讓我們總結一下我們在這裡得出的結論。

 

We have an expression for the cosine of q2 and we have an expression for q1.

我們有cosq2以及q1的表達式。

 

Now, the cosine function is symmetrical about 0.

現在,餘弦函數在0對稱。

 

So, if we know the value of the cosine of q2, then there are two possible solutions a positive angle and a negative angle.

所以,如果我們知道cosq2的值可能有兩種解,正角或負角。

 

We’re going to explicitly choose the positive angle. Which means that I can write this expression here.

我們將明確選擇正角。這意味著我可以在這裡寫這個表達式。

 

And now, we have what we call the inverse kinematic solution for this two-link robot.

現在,我們有了這個二連桿機構的逆向運動學解決方法。

 

We have an expression for the two joined angles, q1 and q2 in terms of the end effector pose x and y, and a bunch of constants.

我們有兩個節點角q1和q2的表達式,根據末端執行器姿勢x和y以及一系列常數。

 

You notice that the two equations are not independent. The equation for q1, in fact, depends on the solution for q2.

你注意到這兩個方程式不是獨立的事實上,q1 的方程取決於 q2 的解。

 

In this case, q2 is negative and we’re going to write the solution for q2 with a negative sign in front of the inverse cosine.

在這種情況下,q2是負數,我們將用負號在cos-1前寫出q2的解。

 

Now, we need to solve for q1, so we’re going to introduce this particular red triangle, the angle beta that we solved previously, and the angle gamma which is defined in terms of y and x.

現在,我們需要求解q1,因此我們將利用這個紅色三角形,我們之前求解的角度β以及根據y、x定義的角度γ。

 

Now, we write a slightly different relationship between q1, gamma and beta, different to what we had before. There’s a change of sign involved.

現在,我們在q1、γ和β之間寫出略有不同的關係,與我們之前的關係不同。 涉及到符號的變化。

 

Then, we can substitute all that previous equation and come up with this expression for q1.

然後,我們可以替換之前的所有等式,並得出q1的這個表達式。

 

Again, there is a change of sign here. Previously, this was a negative sign.

同樣,這裡的符號發生了變化。 以前,這是一個負號。

 

And, here in summary form is the solution for the inverse kinematics of our two-link robot when it is in this particular configuration, where q2 is negative.

並且,這裡是我們的二連桿機構在這種特定配置下的逆向運動學總結形式,其中q2為負。

 

Let’s compare the two solutions, the case where q2 is positive and the case where q2 is negative.

讓我們比較兩個解決方案,q2為正的情況和q2為負的情況。

結論 : 可以利用最終位置的 x、y 來計算機構的轉角 q1、q2

q1 =  tan-1 (y/x) - tan-1 (a2 sinq2/a1+a2 cosq2)

q2 =  cos-1 (x2+y2-a12-a22/2a1a2)


W15 << Previous Next >> using algebra

Copyright © All rights reserved | This template is made with by Colorlib